import java.util.ArrayList;
import java.util.Scanner;


public class Array2 {
	public static void main(String args[]){
		ArrayList <Dog> dogList= new ArrayList <Dog>();
		System.out.println("Enter names. Enter stop when finished.");
		boolean nametime=true;
		Scanner in;
		String name;
		while (nametime==true){
			in= new Scanner(System.in);
			name=in.nextLine();
			if (name.equalsIgnoreCase("Stop"))
				nametime=false;
			else
				dogList.add(new Dog ("5",name));
		}
		System.out.println("Enter the name of the dog you wish to delete. Enter stop to finish");
		boolean deletetime=true;
		String delete;
		while (deletetime==true){
			in= new Scanner(System.in);
			delete=in.nextLine();
			if (delete.equalsIgnoreCase("Stop"))
				deletetime=false;
			else{
				for (int counter=0; counter<dogList.size(); counter++){
					Dog x=dogList.get(counter);
					if (delete.equalsIgnoreCase(x.getName()))
							dogList.remove(counter);
				}
			}
		}
		for (int counter=0; counter<dogList.size(); counter++){
			Dog x=dogList.get(counter);
			System.out.println(x.getName());
		}
		
	}
}
